package com.zds.support.util

import android.app.Activity

/**
 * @author zc
 * @description:
 */

object PopupWindowUtils {
    @JvmStatic
    fun hideAlpha(activity: Activity) {
        backgroundAlpha(activity, 1f)
    }

    @JvmStatic
    fun showAlpha(activity: Activity) {
        backgroundAlpha(activity, 0.4f)
    }

    @JvmStatic
    // 设置屏幕透明度
    fun backgroundAlpha(activity: Activity, bgAlpha: Float) {
        val window = activity.window
        val lp = window.getAttributes()
        lp.alpha = bgAlpha // 0.0~1.0
        window.setAttributes(lp) //act 是上下文context

    }

}